﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ctl="clr-namespace:Thinktecture.UIAnnotations.Behaviors">
    
    <ControlTemplate x:Key="IndicatorWheelTemplate" TargetType="ctl:BusyIndicator">
        <Grid x:Name="LayoutRoot" Opacity="0" HorizontalAlignment="Center" VerticalAlignment="Center">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="LayoutRoot"
 											 Storyboard.TargetProperty="Opacity" 
											 From="1" To="0" Duration="0:0:.25" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="IsBusy">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" 
                                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"
                                                           Storyboard.TargetName="ellipse0">
                                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="360"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever"
                                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"
                                                           Storyboard.TargetName="ellipse1">
                                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="360"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimation Storyboard.TargetName="LayoutRoot" 
											 Storyboard.TargetProperty="Opacity" 
											 From="0" To="1" Duration="0:0:.25" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            
            <Ellipse x:Name="ellipseLayer" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="27.5" Stroke="DarkBlue">
                <Ellipse.Effect>
                    <DropShadowEffect BlurRadius="15"/>
                </Ellipse.Effect>
            </Ellipse>
            
            <Ellipse x:Name="ellipse0" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="27.5"
				     Width="100" Height="100" RenderTransformOrigin="0.5,0.5">
                <Ellipse.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Ellipse.RenderTransform>
                <Ellipse.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                        <GradientStop Color="#FF081087" Offset="1"/>
                        <GradientStop Color="White"/>
                    </LinearGradientBrush>
                </Ellipse.Stroke>
            </Ellipse>
            
            <Ellipse x:Name="ellipse1" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="9.5"
			         Width="85" Height="85" RenderTransformOrigin="0.5,0.5">
                <Ellipse.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Ellipse.RenderTransform>
                <Ellipse.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                        <GradientStop Color="#FF5674BC"/>
                        <GradientStop Color="White" Offset="1"/>
                    </LinearGradientBrush>
                </Ellipse.Stroke>
            </Ellipse>
            
            <Ellipse x:Name="ellipse2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="1.5"
			         Width="50" Height="50" RenderTransformOrigin="0.5,0.5" Stroke="#FF31478D">
            </Ellipse>
            
            <Ellipse x:Name="ellipse3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="1.5"
			         Width="60" Height="60" RenderTransformOrigin="0.5,0.5">
                <Ellipse.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF2450BA" Offset="0"/>
                        <GradientStop Color="White" Offset="1"/>
                    </LinearGradientBrush>
                </Ellipse.Stroke>
            </Ellipse>
            <Ellipse x:Name="ellipse4" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="1.5"
			         Width="95" Height="95" RenderTransformOrigin="0.5,0.5">
                <Ellipse.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF304CA1" Offset="1"/>
                        <GradientStop Color="White"/>
                    </LinearGradientBrush>
                </Ellipse.Stroke>
            </Ellipse>
            
            <Ellipse x:Name="ellipse5" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="1.5"
			         Width="75" Height="75" RenderTransformOrigin="0.5,0.5">
                <Ellipse.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF3548AF"/>
                        <GradientStop Color="White" Offset="1"/>
                    </LinearGradientBrush>
                </Ellipse.Stroke>
            </Ellipse>
        </Grid>
    </ControlTemplate>

    <!--BusyIndicator Template: Dots-->
    <ControlTemplate x:Key="IndicatorDotsTemplate">
        <Canvas x:Name="LayoutRoot" Opacity="0" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Center" 
                VerticalAlignment="Center" Width="100" Height="100" >
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="LayoutRoot"
											 Storyboard.TargetProperty="Opacity" 
											 From="1" To="0" Duration="0:0:.25" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="IsBusy">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="LayoutRoot">
                                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="360"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimation Storyboard.TargetName="LayoutRoot" 
											 Storyboard.TargetProperty="Opacity" 
											 From="0" To="1" Duration="0:0:.25" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Canvas.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </Canvas.RenderTransform>
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="11" Opacity="0.9" Stretch="Fill" Canvas.Top="11" Width="20"/>
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="0" Opacity="0.8" Stretch="Fill" Canvas.Top="40" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="69" Opacity="0.3" Stretch="Fill" Canvas.Top="11" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="80" Opacity="0.4" Stretch="Fill" Canvas.Top="40" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="11" Opacity="0.7" Stretch="Fill" Canvas.Top="69" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="40" Opacity="0.6" Stretch="Fill" Canvas.Top="80" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="69" Opacity="0.5" Stretch="Fill" Canvas.Top="69" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="40" Opacity="0.2" Stretch="Fill" Canvas.Top="0" Width="20" />
        </Canvas>
    </ControlTemplate>

    <!--BusyIndicator-->
    <Style TargetType="ctl:BusyIndicator">
        <Setter Property="Template" Value="{StaticResource IndicatorWheelTemplate}" />
    </Style>
</ResourceDictionary>
